package com.danton.common.bean;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

/**
 * @author sunstar
 *
 * @datetime 2015年5月18日 上午11:56:27
 */
public class CommonResponse implements Serializable{
    
    private static final long serialVersionUID = 1L;
    
    int errno;
    String message;
    Map<String,Object> body;

	public int getErrno() {
		return errno;
	}

	public void setErrno(int errno) {
		this.errno = errno;
	}

	public String getMessage() {
		return message;
	}

	public void setMessage(String message) {
		this.message = message;
	}

	public Map<String, Object> getBody() {
		return body;
	}

	public void setBody(Map<String, Object> body) {
		this.body = body;
	}

	/**
     * @param errno 操作结果
     * @param msg	弹出提示
     */
	public static CommonResponse buildResponse(int errno, String message,Map<String,Object> body) {
		CommonResponse responseStatus = new CommonResponse();
		responseStatus.setErrno(errno);
		responseStatus.setMessage(message);
		responseStatus.setBody(body);
		return responseStatus;
	}
    
	 /**
     * @param errno 操作结果
     * @param msg	弹出提示
     */
	public static CommonResponse buildResponse(int errno, String message) {
		Map<String, Object> body = new HashMap<String, Object>();
		return buildResponse(errno, message, body);
	}
	
	 /**
     */
	public static CommonResponse buildResponse() {
		return buildResponse(0, "success");
	}
}
